#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,m,tgx,tgy,mx=INT_MIN;
    cin>>n>>m;
    int arr[n+5][m+5];
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            cin>>arr[i][j];
    cin>>tgx>>tgy;
    for (int j = 1; j <= m; ++j)
        mx=max(mx,arr[tgx][j]);
    for (int i = 1; i <= n; ++i)
        mx=max(mx,arr[i][tgy]);
    for (int i = 1,j; i <= n; ++i) {
        j=i-tgx+tgy;
        if (j<=0 or j>m)
            continue;
        mx=max(mx,arr[i][j]);
    }
    for (int j = 1,i; j <= m; ++j) {
        i=tgx+tgy-j;
        if (i<=0 or i>n)
            continue;
        mx=max(mx,arr[i][j]);
    }
    cout<<mx<<endl;
    return 0;
}